package com.fowo.api.sys.ssf.controller;

import com.fowo.api.common.model.R;
import com.fowo.api.sys.ssf.SimpleStatusFlowService;
import com.fowo.api.sys.ssf.model.SimpleStatusFlowGraph;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 简单状态流程控制器
 * @author yl_ls
 */
@RestController
@RequestMapping("api/sys/status-flow")
public class StatusFlowController {
    @Resource
    private SimpleStatusFlowService simpleStatusFlowService;

    @GetMapping("{objectName}/{objectId}")
    public R<SimpleStatusFlowGraph> getFlowGraph(
            @PathVariable String objectName,
            @PathVariable Long objectId
    ) {
        return R.data(() -> simpleStatusFlowService.getGraph(objectName, objectId));
    }
}
